package net.sk.dc;

import java.util.HashMap;
import java.util.List;

import net.bat.db.BaseDAOImpl;
import net.bat.util.Cfg;
import net.sk.gti.gtiRobot;
import net.sk.web.HeartThread;
import net.sk.web.Keeper;
import net.sk.web.Provider;

import dao.hb.ODevice;

public class IDC_GTI_Robot implements IDC {

	private gtiRobot qth=null;
	private ODevice od;
	Provider pr;
    public static String PR_GTI_AP="PR_GTI_AP_";
	@Override
	public void open(ODevice od) {
		// TODO Auto-generated method stub
    	this.od = od;
        pr = new Provider(new Keeper(),PR_GTI_AP+od.getId());
        Cfg.getSC().addProvider(pr);
        BaseDAOImpl bdi = (BaseDAOImpl) Cfg.getBean("BaseDAOImpl");
        List ls = bdi.find("select A.id from ODevice A,ODeviceType B where A.status=1 and A.mid=B.id and B.smode='GTI_Robot'");
        if(ls.size()==0){
        	return;
        }
		gtiRobot qth = new gtiRobot(pr,ls.toArray());
		Thread th = new Thread(qth);
		th.start();		
	}

	@Override
	public void close() {
		// TODO Auto-generated method stub
		if(qth!=null){
			qth.stop();
		}
	}

	@Override
	public Object[] get(String[] sns) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object[] getNext(String sn, int length) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void set(HashMap<String, Object> svals) throws Exception {
		// TODO Auto-generated method stub

	}

}
